import pymysql

conn = pymysql.connect(
    host='192.168.72.147',
    port=3306,
    user='root',
    password='123456',
    db='hourse_db'
)

cursor = conn.cursor()


def querys(sql, params, type='no_select'):
    try:
        params = tuple(params)
        cursor.execute(sql, params)
        if type != 'no_select':
            dataList = cursor.fetchall()
            conn.commit()
            return dataList
        else:
            conn.commit()
    except Exception as err:
        conn.rollback()
        pass